package com.cwl.pattern.备忘录模式;

/**
 * @program: pattern
 * @description: 发起人
 * @author: ChenWenLong
 * @create: 2019-07-10 12:51
 **/
public class Originator {

    private String state;

    //设置状态
    public void setState(String state) {
        this.state=state;
    }
    //获取装填
    public String getState() {
        return state;
    }
    //创建备忘录
    public Memento createMemento() {
        return new Memento(state);
    }
    //设置备忘录
    public void restoreMemento(Memento m) {
        this.setState(m.getState());
    }
}
